<div id="breadcrumbAdmin" class = "breadcrumb">
       <?php $this->Html->addCrumb('My shopping bag', '/Items/view', array('style'=> ('text-decoration:underline; color:#EB1E70;'))); ?>
       <?php echo $this->Html->getCrumbs(' > ', array( 'text' => 'Home', 'url' => array('controller' => 'Pages', 'action' => 'pagehome'), 'escape' => false)); ?>
</div>
<div id="shoppingBagLayout">
    <?php echo $this->set('title_for_layout', 'Shopping Cart'); ?>
    <?php echo $this->Html->script(array('cart.js'), array('inline' => false)); ?>
    <h1><?php echo $this->Html->image('glyphicons_012_heart.png', array('alt' => 'Shopping bag icon')); ?> My Shopping Bag <?php echo $this->Html->image('glyphicons_012_heart.png', array('alt' => 'Shopping bag icon')); ?></h1>
    <div class="shoppingBagInside">
        <?php if(empty($shop['OrderItem'])) : ?>
        Shopping Cart is empty
        <?php else: ?>
        <?php echo $this->Form->create(NULL, array('url' => array('controller' => 'shop', 'action' => 'cartupdate'))); ?>
        <hr>
        <table class="t_cart">
         <thead style="text-align:left; line-height:0px;">
          <tr style="border-bottom:solid; font-size:1.5em; font-weight:bold;">
            <th class="span2" style="padding:50px;" >ITEM</th>
            <th class="span5">&nbsp;</th>
            <th class="span2">PRICE</th>
            <th class="span2">SUBTOTAL</th>
            <th class="span2" style="padding-left:35px;" ></th>
          </tr>
          </thead>
          <tbody>
          <?php $tabindex = 1; ?>
        <?php foreach ($shop['OrderItem'] as $item): ?>
          <tr id="row-<?php echo $item['Item']['id']; ?>" style="padding-top:50px;" >
            <td class="ShopCartImg"><?php  echo $this->Html->image(IMG_DIR.'/'.$item['Item']['photo'], array('title' => $item['Item']['photo'],'height' => 150)); ?></td>
            <td style="padding:50px;"><strong><?php  echo $this->html->link($item['Item']['name'], array('controller' => 'items', 'action' => 'view', $item['Item']['id'])); ?></strong></td>
            <td id="price-<?php echo $item['Item']['id']; ?>" style="padding-left:16px;" >$<?php echo $item['Item']['original_price']; ?></td>
            <td id="subtotal-<?php echo $item['Item']['id']; ?>"  style="padding-left:30px;"   >$<?php echo $item['subtotal'] ?></td>
            <td style="padding-left:66px;" ><span class="remove" id="<?php echo $item['Item']['id']; ?>"></span></td>
          </tr>
        <?php endforeach; ?>
          </tbody>
        </table>
        <hr>
        <div class="row">
            <div class="span6 tr" style="padding-top:20px;">
                <?php echo $this->Html->link('<i class=".icon-step-backward icon"></i> Continue shopping', array('controller' => 'Items', 'action' => 'index'), array('class' => 'btn', 'escape' => false)); ?>
                &nbsp; &nbsp;
                <?php echo $this->Html->link('<i class="icon-remove icon"></i> Clear Cart', array('controller' => 'shop', 'action' => 'clear'), array('class' => 'btn', 'escape' => false)); ?>
                <?php echo $this->Form->end(); ?>
            </div>
        </div>

        <hr>
            <div class="row tr cart_checkout">
                <ul>
                    <li>Subtotal: <span class="normal" id="subtotal">$<?php echo $shop['Order']['subtotal']; ?></span></li>
                    <li>Shipping: <span class="normal">TBC<?php echo $shop['Order']['shipping']?></span></li>
                    <li>
                    	<div class="shop_fare">
                    		<ol>
                    			<li class="shipping_free">Free delivery worldwide for orders over $500</li>
                    			<li class="shipping_pay"><input id="shop_fare_1" type="radio" name="shop_fare" value="1" <?php echo $shop['Order']['shipping_type']==1?"checked":"" ?> data-total="<?php echo $shop['Order']['subtotal']+15?>"><label for="shop_fare_1">$15 flat rate for delivery in Australia and New Zealand for orders under $500</label></li>
                    			<li class="shipping_pay"><input id="shop_fare_2" type="radio" name="shop_fare" value="2" <?php echo $shop['Order']['shipping_type']==2?"checked":"" ?>  data-total="<?php echo $shop['Order']['subtotal']+20?>"><label for="shop_fare_2">$20 flat rate for delivery to the rest of the world for orders under $500</label></li>
                    		</ol>
                    	</div>
                    </li>
                    <li style="font-size:2em; font-weight: bold; line-height: 60px;">Order Total: <span class="red" id="total">$<?php echo $shop['Order']['total']?></span></li>
                    <li><?php  echo ("<br>"); ?></li>
                    <li><?php echo $this->Html->link('<i class="icon-white icon-arrow-right "></i>      Checkout', array('controller' => 'shop', 'action' => 'address'), array('class' => 'btn btn-large btn-info ', 'escape' => false)); ?></li>
                    <li><?php  echo ("<br>"); ?></li>
                    <li class="do-checkoutbtn-seperator w308">
                        <span>OR</span>
                    </li>
                    <li style="text-align:center;" class="w308">
                    <small class="do-express-paypal-text">Use PayPal's own checkout, your order will be delivered to the address displayed in your PayPal account.</small>
                    <?php echo $this->Form->create(NULL, array('url' => array('controller' => 'shop', 'action' => 'step1'))); ?>
                    <input type='image' name='submit' src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' border='0' align='top'  alt='Check out with PayPal' class="sbumit" />
                    <?php echo $this->Form->end(); ?>
                    </li>
                </ul>
            </div>
        <br />
        <br />
        <?php endif; ?>

        <?php // debug($this->Session->read('Auth.User.id')); ?>
    </div>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		calculateFreight(<?php echo $shop['Order']['total']?>);
	});
</script>
